<cfcomponent extends="base">

<cffunction name="GET" returntype="any" access="public">

<cfinvoke component="data" method="expertise" returnvariable="expertise">
<cfinvoke component="data" method="companys" returnvariable="companys">

<table border='0' name="main" width="96%" cellspacing="0" cellpadding="0">
<tr><td width="99%">
<!---<h4>Point of Contact Info</h4>--->
<div class="practitioner_edit">

<form name="myform" id="myform" action='' method='post'   enctype="multipart/form-data">

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">POC Type:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="get_poc_type" returnvariable="poc_type">
<select  class="search_select"  name='poc_type' class="search_select"  id='poc_type'><cfloop from="1" to="#poc_type.recordcount#" index="i"><cfoutput><option value="#poc_type.poc_type[i]#" >#poc_type.poc_type[i]#</option></cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Government Type:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="get_gov_type" returnvariable="get_gov_type">
<select  class="search_select"  name='gov_type'  ><cfloop from="1" to="#get_gov_type.recordcount#" index="i"><cfoutput><option class=""  value="#get_gov_type.gov_type[i]#" >#get_gov_type.gov_type[i]#</option></cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Discipline Type:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="get_discipline" returnvariable="get_discipline">
<select  class="search_select"  name='discipline'  ><cfloop from="1" to="#get_discipline.recordcount#" index="i"><cfoutput><option class=""  value="#get_discipline.discipline[i]#" >#get_discipline.discipline[i]#</option></cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Prefix:</span>
<span class="Form_Item_Field"><select  class="search_select"  name='title' class=''><option value='Mr.'>Mr.</option><option value='Ms.'>Ms.</option></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">First Name:</span>
<span class="Form_Item_Field"><input type='text' name='first_name' class=''  value="" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Last Name:</span>
<span class="Form_Item_Field"><input type='text' name='last_name' class=''  value="" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Job Title:</span>
<span class="Form_Item_Field"><input type='text' name='job_title' class=''  value="" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Company:</span>
<span class="Form_Item_Field"><input type="text" id="company_freeform" name="company_freeform" class="" value="">&nbsp;or&nbsp;<select  class="search_select"  class=""  name="company">
<cfloop from="1" to="#companys.recordcount#" index="i">
<cfoutput><option class=""  value="#companys.company[i]#">#companys.company[i]#</option>
</cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Address:</span>
<span class="Form_Item_Field"><textarea name='address' class='' cols="30" rows="6"></textarea></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">City:</span>
<span class="Form_Item_Field"><input type='text' name='city' class=''  value="" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">State:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="states" returnvariable="states">
<select  class="search_select"  name='state'  ><cfloop from="1" to="#states.recordcount#" index="i"><cfoutput><option class=""  value="#states.state_id[i]#">#states.state[i]# - #states.state_id[i]#</option></cfoutput></cfloop></select></span>
</div>


<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Zip Code:</span>
<span class="Form_Item_Field"><input type='text' name='zip'id='zip' class=''  value="" /><span class="Form_Item_Error" id="error_zip"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Phone:</span>
<span class="Form_Item_Field"><input type='text' name='phone'id='phone' class=''  value="" /><span class="Form_Item_Error" id="error_phone"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Alt Phone:</span>
<span class="Form_Item_Field"><input type='text' name='alt_phone' id='alt_phone' class=''  value="" /><span class="Form_Item_Error" id="error_alt_phone"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Email:</span>
<span class="Form_Item_Field"><input type='text' name='email'id='email' class=''  value="" /><span class="Form_Item_Error" id="error_email"></span></span>
</div>

<div class="Content_Margin_Form_Line"><cfinvoke component="data" method="get_5_star_area" returnvariable="get_5_star_area" >
<span class="Form_Item_Label">5 Star Area:</span>
<span class="Form_Item_Field">
<div id="fsa" style="display:inline;"> </div><span id="loading"> </span>
</span></div>


<DIV CLASS="display_area">
<TABLE><TBODY><TR><TD WIDTH="110px"> </TD>
<TD>

<cfset tmp =''>
<TABLE ID="area_table" BORDER="0">
<cfloop from="1" to="#get_5_star_area.recordcount#" index="i">
<tr>
<TD ALIGN="right" WIDTH="1%" ><CFOUTPUT>#get_5_star_area.AREA[I]#</CFOUTPUT>:</TD>
<td align="left" id="parent_area_<cfoutput>#get_5_star_area.five_star_area_category_id[i]#</cfoutput>" class="sub_area"></td>
</tr>
</cfloop>
</table>
<input type="hidden" id="sub_area_list" name="sub_area_list" value="" />
<input type="hidden" id="sid_list"name="sid_list" value="" />

</TD></TR></TBODY></TABLE>
</DIV>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">5 Star Area Experience:</span>
<span class="Form_Item_Field"><input type='text' name='yrs_five_star_area_experience'id='yrs_five_star_area_experience' class='' size='4' value="" />&nbsp;Years <span class="Form_Item_Error" id="error_yrs_five_star_area_experience"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Category Experience:</span>
<span class="Form_Item_Field"><input type='text' name='yrs_category_experience' id='yrs_category_experience' class='' size='4'  value="" />&nbsp;Years <span class="Form_Item_Error" id="error_yrs_category_experience"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Overall Level of Expertise:</span>
<span class="Form_Item_Field"><select  class="search_select"  class=""  name="level_expertise"><cfloop from="1" to="#expertise.recordcount#" index="i">
<cfoutput><option class=""  value="#expertise.expertise[i]#">#expertise.expertise[i]#</option>
</cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Certification:</span>
<span class="Form_Item_Field"><input type='text' name='certification' id='certification' class=''  value="" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Availability Start:</span>
<span class="Form_Item_Field"><input type="text" value="" id='tf_start' name='tf_start'  ></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Availability End:</span>
<span class="Form_Item_Field">
<input type="text" value="" id='tf_end' name='tf_end'  ></span>
</div>


<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Comments:</span>
<span class="Form_Item_Field"><textarea name="comments" cols="60" rows="10"></textarea></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Add Resume':</span>
<input type='hidden' name='poc_id'id='poc_id' value='0' />
<input type='hidden' name='ajax_poc_id'id='ajax_poc_id' value='0' />
<span class="Form_Item_Field"><input type="file" name="uploadfile" id="uploadfile" size="30"></span>
</div>

<div class="Content_Margin_Form_Line"><br>
<span class="Form_Item_Label"></span>
<span class="Form_Item_Field"><input type='submit' class="button"  value="Add Point of Contact" id="save" name="save" /><span id="edit_loading" class="loading"></span>&nbsp;<span class="Form_Item_Error" id="error_save"></span><input type='hidden' name='script' value='poc_detail'></span>
</div>

</form>
</div>

</td></tr>
</table>
</cffunction>

<cffunction access="public" name="POST">


<cfset list_parent = session.queries.make_pList(form.sub_area_list)>
<cfif form.yrs_five_star_area_experience eq "">
<cfset #form.yrs_five_star_area_experience# = 0>
</cfif>
<cfif form.yrs_category_experience eq "">
<cfset #form.yrs_category_experience# = 0>
</cfif>
<cfquery name="insert_detail" datasource="#Session.dsn#">
insert into poc_detail(first_name, last_name, address, city, state, zip, phone, alt_phone, email, title,poc_type,comments, job_title,  gov_type, discipline, yrs_five_star_area_experience, yrs_category_experience, five_star_area, five_star_category,company,availability_start ,availability_end, certification)
values('#form.first_name#', '#form.last_name#', '#form.address#', '#form.city#', '#form.state#', '#form.zip#', '#form.phone#', '#form.alt_phone#', '#form.email#', '#form.title#', '#form.poc_type#', '#form.comments#', '#form.job_title#', '#form.gov_type#', '#form.discipline#', #form.yrs_five_star_area_experience#, #form.yrs_category_experience#, '#list_parent#','#form.sub_area_list#',<cfif form.company_freeform neq "" or form.company eq "not_selected">'#form.company_freeform#'<cfelse>'#form.company#'</cfif>, <cfif form.tf_start eq "">'#dateformat("01-01-1900","mm/dd/yyyy")#'<cfelse>'#dateformat(tf_start,"mm/dd/yyyy")#'</cfif>, <cfif form.tf_end eq "">'#dateformat("01-01-3000","mm/dd/yyyy")#'<cfelse>'#dateformat(tf_end,"mm/dd/yyyy")#'</cfif>, '#form.certification#');

</cfquery>

<cfquery name="get_id" datasource="#session.dsn#" maxrows="1" >
SELECT *
FROM poc_detail
order by poc_id desc
</cfquery>

<cftry >
<cfif form.uploadfile neq "">
<cffile action="upload" fileField="form.uploadfile" destination="#Session.file_path#repository\" nameconflict="makeunique" result="file_name">
<cfquery name="insert_detail2" datasource="#Session.dsn#">
insert into resume_directory(poc_id, resume_location, resume_title)
values( #get_id.poc_id#,'/repository/#file_name.clientFile#', '#file_name.serverFileName#.#file_name.ClientFileExt#');

</cfquery>
</cfif>

<cflocation url="/edit.cfm?id=#get_id.poc_id#" addtoken="no">

<cfcatch type="any">
<cflocation url="/edit.cfm?id=#get_id.poc_id#" addtoken="no">
</cfcatch>
</cftry>

</cffunction>

</cfcomponent>